<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <title>title</title>
    <link rel="stylesheet" type="text/css" href="../css/api.css"/>
    <style>
        html, body {
        	height: 100%;
            background-color: rgba(0, 0, 0, 0.5);
        }
        .content {
        	height: 100%;
        	padding: 0 46px;
        	display: -webkit-box;
        	-webkit-box-align: center;
        }
        .main {
        	width: 100%;
        	border-radius: 5px;
        	background-color: #fff;
        	overflow: hidden;
        }
        .main .main_t {
        	height: 50px;
        	line-height: 50px;
        	font-size: 16px;
        	color: #333;
        	text-align: center;
        	border-bottom: 1px solid #e8e8e8;
        }
        .main .main_b {
        	padding: 15px;
            padding-bottom: 0;
            text-align: center;
        }
        .main_b img{
            margin: 0 auto;
            display: inline-block;
            width: 200px;
        }
        .btn_box{
            line-height: 60px;
            color: #40afe2;
        }
    </style>
</head>
<body>
	<div class="content" id="dialog">
	    <div class="main">
	    	<div class="main_t">请商家扫描二维码</div>
	    	<div class="main_b">
                <div id="orderC"></div>
                <div class="btn_box" tapmode onclick="api.closeFrame();">
                	关闭
                </div>
	    	</div>
	    </div>
	</div>
</body>
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="../script/zepto.js"></script>
<script type="text/javascript" src="../script/qrcode.min.js"></script>
<script type="text/javascript" src="../script/common.js"></script>
<script type="text/javascript">
    apiready = function(){
        var order_staff = api.pageParam.order_staff;
        /*$(document.body).on('touchend', function(e) {
            var dialog = $('#dialog')[0];
            if (!$.contains(dialog, e.target)) {
                $('#dialog').removeClass('in');
                setTimeout(function() {
                    api.closeFrame();
                }, 200);
            }
        });*/
        var qrcode = new QRCode(document.getElementById("orderC"), {
            width : 200,
            height : 200
        });
        qrcode.makeCode(order_staff.toString());

        // 关闭骑手端二维码的frame
        api.addEventListener({
            name: 'confirmStaffOrder'
        }, function(ret, err){
            if( ret ){
                setTimeout(function(){
                    api.closeFrame();
                },500);
            }
        });
    };

    // 关闭
    function fnClose() {
        setTimeout(function() {
            api.closeFrame();
        }, 200);
    }
</script>
</html>